package ShapeDemo;

interface IShape {
    void draw();
}
class Flower1 implements IShape {

    @Override
    public void draw() {
        System.out.println("画❀");
    }
}
class Rect1 implements  IShape {

    @Override
    public void draw() {
        System.out.println("画矩形");
    }
}
class  Cycle1 implements  IShape {
    @Override
    public void draw() {
        System.out.println("画圆圈");
    }
}
public class Test1 {
    public static void func(IShape ishape) {
        ishape.draw();
    }
    public static void main(String[] args) {
        func(new Flower1());
        func(new Cycle1());
        func(new Rect1());
    }
    public static void main1(String[] args) {
        // 创建对象
        IShape flower = new Flower1();
        IShape rect1 = new Rect1();
        IShape cycle1 = new Cycle1();

        // 调用draw方法进行绘画
        flower.draw();
        rect1.draw();
        cycle1.draw();
    }
}
